function [Par,Step,Trans] = Trade_ctrf_spill(Par)

Par.pi_dom = Par.bet*((1-Par.bet)/Par.eta)^((1-Par.bet)/Par.bet);
Par.pi_frn = Par.bet*((1-Par.bet)/(Par.eta*(1+Par.kapa)*(1+Par.trf_B)))^((1-Par.bet)/Par.bet);
Par.pi_frn_toUS = Par.bet*((1-Par.bet)/(Par.eta*(1+Par.kapa)*(1+Par.trf_A)))^((1-Par.bet)/Par.bet);

Par.madj = min(ceil((1-Par.bet)/Par.bet*log((1+Par.kapa)*(1+Par.trf_B))/log(Par.lmd))-1,Par.mbar);
Par.madj_toUS = min(ceil((1-Par.bet)/Par.bet*log((1+Par.kapa)*(1+Par.trf_A))/log(Par.lmd))-1,Par.mbar);

L_A = Par.L_A;
L_B = Par.L_B;

% ==== Leapfrogging & Profit Functions ====

steps = (Par.mbar:-1:-Par.mbar)';

LF_aux = zeros(Par.mtot);
LF_pmf = zeros(Par.mtot);
for ctr_loc = 2:2*Par.mbar

	LF_aux = LF_aux+diag(ctr_loc*(diag(LF_aux,ctr_loc)+1),ctr_loc);

end
LF_aux = LF_aux+diag(1*(diag(LF_aux,1)+1),1);

lf_pmf  = flip((1:2*Par.mbar)'.^-Par.phy/sum((1:2*Par.mbar).^-Par.phy));
lf_pmf2 = lf_pmf; % change to one of the next two lines
% lf_pmf2 = flip((1:2*Par.mbar)'.^-(1.2*Par.phy)/sum((1:2*Par.mbar).^-(1.2*Par.phy)));
% lf_pmf2 = flip((1:2*Par.mbar)'.^-(1.4*Par.phy)/sum((1:2*Par.mbar).^-(1.4*Par.phy)));
for ctr_pmf = 2*Par.mbar:-1:Par.mbar+1

    LF_pmf(1:ctr_pmf,ctr_pmf+1) = [lf_pmf2(1:ctr_pmf-1); sum(lf_pmf2(ctr_pmf:end))];
    
end

for ctr_pmf = Par.mbar:-1:1

    LF_pmf(1:ctr_pmf,ctr_pmf+1) = [lf_pmf(1:ctr_pmf-1); sum(lf_pmf(ctr_pmf:end))];
    
end


prft_fnc_A = [];
        
prft_fnc_B = [];
          
wage_dom   = [];  
wage_dom_B = [];

% ==== Auxiliary Matrices, Q transition ====

Trans.Qloc_idom = -1*eye(2*Par.mbar+1);
Trans.Qloc_idom(1) = Par.lmd-1;

Trans.Qloc_frn_R  = rot90(eye(2*Par.mbar+1));
Trans.Qloc_ifrn_L = rot90(-1*eye(2*Par.mbar+1));
Trans.Qloc_ifrn_L(end,1) = Par.lmd-1;

Qloc_edom = Trans.Qloc_idom;
Trans.Qloc_edom = Qloc_edom+LF_pmf.*Par.lmd.^LF_aux;
Trans.Qloc_idom = Trans.Qloc_edom;

Qloc_efrn_L = Trans.Qloc_ifrn_L;
Trans.Qloc_efrn_L = Qloc_efrn_L+flipud(LF_pmf);
Trans.Qloc_ifrn_L = Trans.Qloc_efrn_L;

Trans_innov = Trans.Qloc_idom+eye(Par.mtot);
Trans_fail  = rot90(Trans.Qloc_ifrn_L)+eye(Par.mtot);
Trans_exo   = -diag(steps~=0)+diag(steps(1:end-1)>0,1)+...
               Par.lmd*diag(steps(2:end)<0,-1);
           
Trans.Qtr_exo = Par.dlt*Trans_exo';

Step = {steps,Trans_innov,Trans_fail,Trans_exo,[prft_fnc_A prft_fnc_B],[wage_dom; wage_dom_B]};

% ==== Auxiliary Matrices, MU transition ====          
          
Trans.Muloc_idom = -1*eye(2*Par.mbar+1);
Trans.Muloc_idom(1) = 0;

Trans.Muloc_frn_R  = rot90(eye(2*Par.mbar+1));
Trans.Muloc_ifrn_L = rot90(-1*eye(2*Par.mbar+1));
Trans.Muloc_ifrn_L(end,1) = 0;

Muloc_edom = Trans.Muloc_idom;
Trans.Muloc_edom = Muloc_edom+LF_pmf;
Trans.Muloc_idom = Trans.Muloc_edom;
        
Muloc_efrn_L = Trans.Muloc_ifrn_L;
Trans.Muloc_efrn_L = Muloc_efrn_L+flipud(LF_pmf);
Trans.Muloc_ifrn_L = Trans.Muloc_efrn_L;

Trans.Mutr_exo = Par.dlt*(-diag(steps~=0)+diag(steps(1:end-1)>0,1)+...
                  diag(steps(2:end)<0,-1))';